using System;
using System.Drawing;
using System.Windows.Forms;

namespace EForms
{

	public class ListViewOperations
	{
		private ListViewOperations()
		{
		}

		public static void IterateColors( ListView lv, Color color1, Color color2 )
		{
			for( int i = 0; i < lv.Items.Count; i++ )
			{
				Color backColor;
				
				if( i % 2 == 0 ) backColor = color1;
				else backColor = color2;

				if( lv.Items[i].UseItemStyleForSubItems )
				{
					lv.Items[i].BackColor = backColor;
				}
				else
				{
					lv.Items[i].BackColor = backColor;
					for( int j = 0; j < lv.Items[i].SubItems.Count; j++ )
					{
						lv.Items[i].SubItems[j].BackColor = backColor;	
					}
				}
			}
		}
		
		public static void IterateColors( ListView lv )
		{
			IterateColors( lv, Color.White, Color.WhiteSmoke );
		}
	}
}
